import java.util.Scanner;

public class Solution {
    public int countSegments(String s) {
        int segmentCount = 0;
        //判断是否为单词
        for (int i = 0; i < s.length(); i++) {
            if ((i == 0 || s.charAt(i - 1) == ' ') && s.charAt(i) != ' ') {
                segmentCount++;
            }
        }
        return segmentCount;
    }

    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        Solution solution = new Solution();
        String s = scanner.nextLine();
        int ret = solution.countSegments(s);
        System.out.print(ret);
    }
}
